﻿using System;

namespace Borg.AddOn
{
    [Serializable]
    internal sealed class InstanceStoreSubstitutionHookChain : IInstanceStoreSubstitutionHook
    {
        private readonly IInstanceStoreSubstitutionHook[] _hooks;

        public InstanceStoreSubstitutionHookChain(IInstanceStoreSubstitutionHook[] hooks)
        {
            _hooks = hooks;
        }

        public void SubstituteForIsPlugged(ref Slot slot, ref Plug plug)
        {
            foreach (IInstanceStoreSubstitutionHook hook in _hooks)
                hook.SubstituteForIsPlugged(ref slot, ref plug);
        }

        public void SubstituteForIsTagged(ref Slot slot, ref Plug plug, string tag)
        {
            foreach (IInstanceStoreSubstitutionHook hook in _hooks)
                hook.SubstituteForIsTagged(ref slot, ref plug, tag);
        }
    }
}
